﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<dbPoll_Application.ViewModels.PollReportViewModel>" %>

<input type="hidden" id="pollID" name="pollID" value="<%=Model.pollID %>" />
 <table><tbody><tr><td><label for="fields">
 Filter results by:</label><select name="field" id="fields" onchange="alter(this.options[selectedIndex].value)">
 <% foreach (var field in Model.poll.participantFields)
   {
      if (Model.field != null && Model.field.fieldID!=-1 && Model.field == field)
      {%><option value="<%=field.fieldID %>" selected="selected"><%=field.name%></option><%}
      else
      {%><option value="<%=field.fieldID %>"><%=field.name%></option><%}
   }%></select></td>
 <td><select name="include"><option>include</option>
 <% if (Model.include == false)
   { %><option selected="selected">exclude</option><% }
    else
   {%><option>exclude</option><% }%>
 </select></td>
 <td><span id="values" style="float:right;height: 100px; min-width:100px; overflow: auto;border: 1px solid #EEE;">
 <% var fielding=Model.field;
 if (fielding == null) fielding = Model.poll.participantFields.FirstOrDefault();
 if (fielding!=null){%><%=Model.choices(fielding.fieldID,Model.tick,Model.pollID)%><%} %>
 </span></td><td><input type="submit" value="Filter Results"/></td></tr></tbody></table>
